<template>
  <div>
    <nav-bar>
      <template v-slot:left>
        <div class="left" @click="goBack">
          <img src="~assets/img/profile/left.png" alt="" />
        </div>
      </template>
      <template v-slot:center>QQ登录</template>
    </nav-bar>
    <div class="form">
      <input
        type="text"
        class="account"
        placeholder="QQ账号"
        v-model="account"
      />
      <input
        type="password"
        class="password"
        placeholder="QQ密码"
        v-model="password"
      />
      <div class="btn" @click="login">登录</div>
    </div>
    <div class="footer">
      注:账号密码仅用于测试 <br /><span>测试账号:12131415</span>
      <span>测试密码:123456</span>
    </div>
  </div>
</template>

<script>
import NavBar from "@/components/common/navbar/NavBar";
export default {
  name: "QQLogin",
  data() {
    return {
      account: "",
      password: "",
    };
  },
  components: {
    NavBar,
  },
  methods: {
    goBack() {
      this.$router.go(-1);
    },
    login() {
      if (this.account === "12131415") {
        if (this.password === "123456") {
          this.account = "";
          this.password = "";
          this.$store.commit("loginState");
          this.$router.push("/profile");
        }
      } else {
        this.$toast.show("账号或者密码错误!", 4000);
      }
    },
  },
};
</script>

<style scoped>
.left {
  width: 100%;
  height: 100%;
}
.left img {
  width: 18px;
  height: 18px;
}
.form {
  margin-top: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
}
.form input {
  outline: none;
  border: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #cccc;
  font-size: 20px;
}
.form .account {
  width: 70%;
  margin-bottom: 30px;
}
.form .password {
  width: 70%;
}
.form input::-webkit-input-placeholder {
  color: #cccccc;
}
.form input::-moz-placeholder {
  /* Mozilla Firefox 19+ */
  color: #cccccc;
}
.form input:-moz-placeholder {
  /* Mozilla Firefox 4 to 18 */
  color: #cccccc;
}
.form input:-ms-input-placeholder {
  /* Internet Explorer 10-11 */
  color: #cccccc;
}
.btn {
  width: 80%;
  font-size: 20px;
  text-align: center;
  margin-top: 50px;
  background-color: var(--color-tint);
  height: 50px;
  line-height: 50px;
  color: #ffffff;
  border-radius: 25px;
}
.footer {
  position: absolute;
  bottom: 55px;
  width: 100%;
  text-align: center;
  font-size: 11px;
  color: #777373;
}
.footer span {
  padding: 0 5px;
}
</style>
